<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
<head>
    <title><!--考勤管理--></title>
    <meta charset="utf-8">
    <meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
    <link rel="stylesheet" href="css/project/ui-res-v3.css">
    <link rel="stylesheet" href="css/project/ui-input-v3.css">
    <link rel="stylesheet" href="css/project/ui-color-v3.css">
	<link rel="stylesheet" href="css/project/style.css">
    <link rel="stylesheet" href="css/ui-base.css">
    <link rel="stylesheet" href="css/ui-box.css">
	<link rel="stylesheet" href="css/zv_common.css">
    <script src="js/zy_control.js"></script>
    <script src="js/zy_click.js"></script>
	<script src="js/zy_json.js"></script>
	<script src="js/main.js"></script>
	<script src="js/init.js"></script>
    <script type="text/javascript" src="js/JsonSQL/jsonsql-0.1.js"></script>
	<script src="js/talkingdata.js"></script>
</head>
<body class="um-vp nobg " ontouchstart>
<div id="page_1" class="ub ub-ver um-vp">
<div class="ub ub-ver ">
	<div class="fline  c-wh">
	<!--下拉列表开始-->
	<div class="ub t-bla ub-ac umar-t nobg">
	    <div class="ulim umw4 umar-r">站点名称</div>
	    <div class="ub-f1 ub uba  b-gra  sel noboder">
	        <div class="ub-f1 ut-s uinn tx-l t-gra ulh-sel"  id="SiteName_default">选择站点名称</div>
	        <div class="b-gra  umw2 ub ub-pc ub-ac">
	            <div class="ub-img umw1 umh1 res3"></div>
	        </div>
	         <select name="SiteName" selectedindex="0" id="SiteName" onchange="zv_linkage(this.id,'zv_default','SiteID','全部附属站点','<option value=0>全部附属站点</option>')"></select>
	    </div>
	</div>
	<!--下拉列表结束-->
   </div>
    
   <div class="fline  c-wh">
	<!--下拉列表开始-->
	<div class="ub t-bla ub-ac umar-t nobg">
	    <div class="ulim umw4 umar-r">附属站点</div>
	    <div class="ub-f1 ub uba  b-gra  sel noboder">
	        <div class="ub-f1 ut-s uinn tx-l t-gra ulh-sel" id="zv_default">全部附属站点</div>
	        <div class="b-gra  umw2 ub ub-pc ub-ac">
	            <div class="ub-img umw1 umh1 res3"></div>
	        </div>
	          <select name="SiteID" selectedindex="0" id="SiteID" onchange="zy_selectmenu(this.id)">
	         </select>
	    </div>
	</div>
	<!--下拉列表结束-->
   </div>
   
   <div class="fline   c-wh">
   	 <div class="ub ulab ub-ac umh1 umar-t " >
			<div class="umw4 ">员工工号</div>
			<div class="uba ub-f1 b-bla uinput uc-a1 noboder nobg" style="padding-left:0.5em; padding-right:0.5em">
		            	<input placeholder="请输入员工工号" type="text"   id="EmployeeNumber"  style="width:100%; height:1.8em; border:0px;outline:none " class="t-gra"  value="">
			</div>
		</div>
	</div>
	<div class="fline   c-wh">
	    <div class='ub umar-t ub-ac' >
		<div class=" ub-ac　ulim ulev0 umw4" style="height:2em; line-height:2em">起始日期</div>
		 <div class="ub ub-f1 uba ub-ac b-bla b-norarea   noboder nobg" >
	 	<div class="ub-f1 ut-s uinn   tx-l t-gra ulh-sel " id="PeriodStart" style="width:100%;" onclick="checked_day('PeriodStart')">请选择开始日期</div>
	    </div>
	</div>
	</div>
<!--起始日期结束-->
<div class="fline   c-wh">
    <div class='ub umar-t ub-ac' >
	<div class=" ub-ac　ulim ulev0 umw4 datecolor" style="height:2em; line-height:2em">结束日期</div>
    <div class="ub ub-f1 uba ub-ac b-bla b-norarea c-wh noboder nobg"  >
    <!--文本输入开始-->
	<div class="ub-f1 ut-s uinn tx-l t-gra ulh-sel" id="PeriodEnd" style="width:100%; " onclick="checked_day('PeriodEnd')">请选择结束日期</div>
	<!--文本输入结束-->
    </div>
</div><!--结束日期结束-->
</div>
<!--提交按钮-->

<div ontouchstart="zy_touch('zv-btn-act')" class="zvbtn  c-blu1  t-wh tx-c uc-a1 zvbtnpadding"   onclick="LoadDataS_q()" >确 定</div>
<input id="page" type="hidden" valuer="1">
</div>
<div class="logobg"><img src="images/logobg.png"  width="80%"></div>
</div>


</body>
<script>
zy_init();
window.uexOnload=function(type){
	if(!type){
		uexWindow.setBounce("0");
		IC.talkingDataCount("考勤管理","0018");
	}
	wen_loading();
}

function wen_loading(){
	var user_name=localStorage['LoginInfor'];
	if(user_name!=''&user_name!='null' &user_name!=null&user_name!='undefined'&user_name!=undefined)
	{
		Loading(0);	
		user_name='['+user_name+']'
		var jsonuser = strToJson(user_name)
		var user_id=jsonuser[0].username
		$.getJSON(host_address_url+"GetUserInfo?RequestKey="+RequestKey+"&act=GetUserSite&UID="+user_id,function(json)	{
			Loading(-1);
				var json = JSON.stringify(json)
				json='['+json+']'
				json = strToJson(json)
				var Site=json[0].Site
				if(Site!=''&Site!='null' &Site!=null&Site!='undefined'&Site!=undefined)
				{
					$.getJSON(ceair_class_url, function(jjson){
						var res = jsonsql.query("select * from json.data.items where (Site=='"+Site+"' && TagName=='site')  order by OrderBy asc", jjson);
						if(res.length>0)
						{
//							$$("zv_default").innerHTML =res[0].Name;
//							select_default_val(res[0].PID,'SiteID','<option value="">选择站点名称</option>',res[0].ID) 
								var ress = jsonsql.query("select * from json.data.items where (PID=='"+res[0].PID+"')  order by OrderBy asc", jjson);
								var selectval='<option value="">选择站点名称</option>'
								for(var i=0; i<ress.length; i++)
								{
									var selected_id=''
									if(ress[i].ID==res[0].ID)
									{
										selected_id=' selected'
									}
									selectval+='<option value="'+ress[i].Code+'" '+selected_id+'>'+ress[i].Name+'</option>'
								}
								$$("SiteID").innerHTML=selectval;
							$$("zv_default").innerHTML =res[0].Name;
								var  pid_res= jsonsql.query("select * from json.data.items where (ID=='"+res[0].PID+"' && TagName=='site')  order by OrderBy asc", jjson);
							$$("SiteName_default").innerHTML =pid_res[0].Name;
							select2_val(pid_res[0].PID,'SiteName','<option value="">选择站点名称</option>',pid_res[0].ID) 
						}
					});
				}
				else
				{
					select2_val('5','SiteName','<option value="">选择站点名称</option>')
				}
		})
		
	}
	else
	{
		select2_val('5','SiteName','<option value="">选择站点名称</option>')
	}
	$$("PeriodStart").innerHTML = getNowFormatDate();
	var backup_PeriodStart_pb= localStorage.getItem("backup_PeriodStart_pb")
	if(backup_PeriodStart_pb!='null' && backup_PeriodStart_pb!=null && backup_PeriodStart_pb!='' &&backup_PeriodStart_pb!=undefined)
	{
	$$("PeriodStart").innerHTML =backup_PeriodStart_pb;	
	}
	$$("PeriodEnd").innerHTML = getNowFormatDate();
	var backup_PeriodEnd_pb= localStorage.getItem("backup_PeriodEnd_pb")
	if(backup_PeriodEnd_pb!='null' && backup_PeriodEnd_pb!=null && backup_PeriodEnd_pb!='' &&backup_PeriodEnd_pb!=undefined)
	{
	$$("PeriodEnd").innerHTML =backup_PeriodEnd_pb;	
	}
}
function LoadDataS_member(){//查询员工号
		Loading(0);
		var EmployeeNumber = $$("EmployeeNumber").value;/*员工工号*/
		var user_name=localStorage['LoginInfor']
		user_name='['+user_name+']'
		var jsonuser = strToJson(user_name)
		var user_id=jsonuser[0].username
		var jsonPage = [{'key': 'act','type': '0','value': 'GetRole'}, {'key': 'Account','type': '0','value':user_id}];
		$.getJSON(host_address_url + "GetUserInfo", function(json){
			if (json.indexOf(7) > -1 || json.indexOf(4) > -1 || json.indexOf(9) > -1)//部领导，部门领导，区域经理
			{
				LoadDataS(1)	
			}
			else
			{	
				if(EmployeeNumber!='')
				{
					$.getJSON(host_address_url+"GetUserInfo?RequestKey="+RequestKey+"&act=AccountDomain&Account="+user_id,function(json)	{
						if(json==0){user_json_id=user_id;}else{user_json_id=json;} 
							if(EmployeeNumber==user_json_id)
							{
								LoadDataS(1)	
							}
							else
							{
								$alert('员工号错误，请重新输入!');
								Loading(-1);
								return false;	
							}
					})
				}
				else
				{
					$alert('请输入您的员工号!');
					Loading(-1);
					return false;	
				}
			}	
	   }, "str", function(e){alert(JSON.stringify(e))}, "POST", jsonPage, false);
}
var bodyH = document.body.clientHeight;
document.getElementById("page_1").style.height=(bodyH-10)+"px"
function LoadDataS_q()
{
	uexEMM.setEvent("1","{'考勤管理':'考勤搜索'}");
	IC.talkingDataCount("考勤管理","0018");
     checkUserRole(ZV_EMPLOYEE_NUMBER, 'BTN_0_32', function(){ LoadDataS_member(); });
//	var jsonPage =[{'key':'RequestKey','type':'0','value':RequestKey},{'key':'act','type':'0','value':'GetBtnCode'},{'key':'EMPLOYEE_NUMBER','type':'0','value':ZV_EMPLOYEE_NUMBER},{'key':'AppBtnCode','type':'0','value':'BTN_0_32'}];
//	$.getJSON(host_address_url+"GetUserInfo",function(json){
//	alert(json)
//	},"str",function(e){},"POST",jsonPage,false);
}




function LoadDataS(page,content_page)
{
		if(content_page!=''&&content_page!='undefined'&&content_page!=undefined)
		{
			localStorage.setItem("content_page",content_page);
		}	
		localStorage.setItem("attendance_management_page",page);
		var SiteName = $$("SiteName").value; /*站点名称*/
		var SiteID = $$("SiteID").value; /*站点名称*/
		var EmployeeNumber = $$("EmployeeNumber").value;/*员工工号*/
		var PeriodStart =$$("PeriodStart").innerHTML;/*开始时间*/
		var PeriodEnd =$$("PeriodEnd").innerHTML;/*结束时间*/
		localStorage.setItem("backup_PeriodStart_kq",PeriodStart);/*考勤开始时间*/
		localStorage.setItem("backup_PeriodEnd_kq",PeriodEnd);/*考勤结束时间*/
		if (SiteName == '') {
			$alert('请选择站点名称');
			return false;
		}
		else if (PeriodStart == '' || PeriodStart == '请选择开始日期' ) {
					$alert('请选择开始日期');
					return false;
		}
		else if (PeriodEnd == '' || PeriodEnd == '请选择结束日期' ) {
			$alert('请选择结束日期');
			return false;
		}
		else if (PeriodEnd < PeriodStart) {
			$alert('结束日期不能小于开始日期');
			return false;
		}
		else {
			uexEMM.setEvent("1","{'考勤管理':'考勤管理搜索'}");
			var SiteName = SiteName.split("|");
			SiteName=SiteName[1]
			
			if(SiteID=='')
			{
				SiteID='0'
			}
			localStorage.setItem("SiteName",SiteName);//站点名称
			localStorage.setItem("SiteID",SiteID);//附属站点
			localStorage.setItem("EmployeeNumber",EmployeeNumber);//员工工号
			localStorage.setItem("PeriodStart",PeriodStart);//开始日期
			localStorage.setItem("PeriodEnd",PeriodEnd);//结束日期
			var wsdl = attendance_management_list_url
		    var nameSpace = attendance_management_list_nameSpace 
			var paras = "CenterName|EmployeeNumber|PeriodStart|PeriodEnd|SiteID|PageCount|CurrentPage";
			var values = SiteName+'|'+EmployeeNumber+'|'+PeriodStart+'|'+PeriodEnd+'|'+SiteID+'|20|'+page;
			var method =attendance_management_list_function
			if(page>=2)
			{
				setLocalJosnPage(wsdl,nameSpace,paras,values,method,"attendance_management","attendance_list");		
			}
			else
			{
				setLocalJosn(wsdl,nameSpace,paras,values,method,"attendance_management","attendance_management.html");	
			}
		}
}

</script>
</html>
